<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
const beforeUnload = function (e) {
  debugger
  let path = window.location.pathname
  console.log("===path2="+path+"===");
  if(path.indexOf('/model/')>-1){
    return 0;
  }
  e = e || window.event
  if (e || window.event) e.returnValue = 1;
  return 1;
}

// const postmessageHandle = (e) => {
//   debugger
//   console.log("===postmessageHandle e="+JSON.stringify(e)+"===");
//     if(e&&e.data&&e.data.url) {
//       this.$router.push(e.data.url)
//     }
//   }
export default {
  name: 'App',
  mounted() {
   this.$nextTick(() => {
      window.addEventListener('beforeunload', beforeUnload)

      // //iframe 内监听到菜单消息进行路由跳转
      // window.addEventListener('message',postmessageHandle)
    })
  },
  beforeDestroy() {
    window.removeEventListener('beforeunload', beforeUnload)
  },
  onLaunch: function() {
    console.log('App Launch')
    this.$AppReady.then(()=>{
      console.log(this.$Route)	
    })
  },
  onShow: function() {
          console.log('App Show')
    this.$AppReady.then(()=>{
      console.log(this.$Route)	
    })
  }
}
</script>